<!DOCTYPE HTML>
<html>
  <head>
    <title>Teamspeak and phpBB Forums EVE Online API Registration System</title>
    <style type="text/css">
html {
  background-color: #333;
  color: #fff;
  font-family: 'Trebuchet MS', sans-serif;
}
a, strong {
  color: #99f;
  font-weight: normal;
}
ol ol {
  list-style-type: lower-alpha;
}
a img {
  border-style: none;
}
    </style>
  </head>
  <body>
    <h1>
      Teamspeak and phpBB Forums EVE Online API Registration System
    </h1>
    <ul>
      <li>Author: Zach Callear (MisterMagotchi)
      </li>
      <li>Version: 1.56
      </li>
      <li>Release Date: 2011-10-06
      </li>
      <li>License: <a href="http://www.gnu.org/licenses/gpl.html">GPLv3</a> (since it uses the GPL'd <a href="http://addons.teamspeak.com/directory/tools/integration/TeamSpeak-3-PHP-Framework.html">TeamSpeak 3 PHP Framework</a>)
      <li>More info: <a href="http://callear.org/teamspeak-phpbb-eve-api-registration/">Script Info Page</a> or <a href="https://forums.eveonline.com/default.aspx?g=posts&amp;t=6815">EVE Forums Thread</a>
      </li>
      <li>Contact: <a href="http://mailhide.recaptcha.net/d?k=01YwWDApWcwvHqmA7V8PlypA==&amp;c=wUNZEWUdaCZq5PN8gg3O0e4WXZZllpnu68lE_UVh9iw=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01YwWDApWcwvHqmA7V8PlypA==&amp;c=wUNZEWUdaCZq5PN8gg3O0e4WXZZllpnu68lE_UVh9iw=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;">Email me</a>
      </li>
    </ul>
    <h2>
      Features Summary
    </h2>
    <ul>
      <li>Uses the new, customizable API keys system
      </li>
      <li>Combines phpBB (forums) registration with Teamspeak registration
      </li>
      <li>Teamspeak functionality is optional
      </li>
      <li>Automatically puts users in groups in Teamspeak and phpBB based on EVE corporation via EVE API
      </li>
      <li>Automatically removes users from those groups if their API information becomes invalid or if they are no longer in a configured corporation
      </li>
      <li>Automatically switches members between corp. groups if they switch from one configured corp. to another
      </li>
      <li>Several corporations can be assigned to the same Teamspeak or forums group if desired
      </li>
      <li>Users can re-do the API registration as many times as they need to
      </li>
      <li>Provides an admin interface for admins to view a list of registration information and the error log (for troubleshooting)
      </li>
      <li>Minimum required customizable API key access level and key type (Account or Character) are customizable
      </li>
      <li>Reasonably well-documented code for easy customization
      </li>
    </ul>
    <h2>
      Requirements
    </h2>
    <ul>
      <li>PHP 5
        <ul>
          <li>allow_url_fopen must be on
          </li>
        </ul>
      </li>
      <li>MySQL
      </li>
      <li>Linux or Linux-like OS
        <ul>
          <li>Basically it should still work fine in Windows, but it uses the "tail" command once in the Registration List script (/admin/ page) to show the last 10 log lines, so that will break.
          </li>
        </ul>
      </li>
      <li>Apache's AllowOverride setting
        <ul>
          <li>Allows blocking direct web access to files via .htaccess. Alternatively you can block direct web access to the check-users.php script and errors.txt in some other way.
          </li>
          <li>Usually enabled on shared hosting
          </li>
        </ul>
      </li>
      <li>PHP's SimpleXML
        <ul>
          <li>Enabled by default PHP 5.1.2 or newer
          </li>
        </ul>
      </li>
      <li>phpBB
        <ul>
          <li>Must be on the same domain (hostname to be exact) due to cross-domain cookie access issues
          </li>
        </ul>
      </li>
      <li>Teamspeak 3
        <ul>
          <li>Doesn't need to be on the same server
          </li>
        </ul>
      </li>
      <li>Cron
        <ul>
          <li>Alternatively, the ability to otherwise make php scripts run in a timed manner.
          </li>
        </ul>
      </li>
    </ul>
    <h2>
      Installation
    </h2>
    <ol>
      <li>Put everything from this package somewhere in your publicly accessible web space.
        <ul>
          <li>This will determine the URL of the registration page (eg. "example.com/eve-api-reg/" if extracted to the root of your web space and not renamed).
          </li>
        </ul>
      </li>
      <li>Make <strong>errors.txt</strong> writable by the web server user.
        <ul>
          <li>Either make it owned by the user the web server runs as or allow others to write to it (chmod 666).
          </li>
        </ul>
      </li>
      <li>Edit <strong>config.inc.php</strong> to your liking.
        <ul>
          <li>All settings in there are obvious and/or documented.
          </li>
        </ul>
      </li>
      <li>If running Teamspeak and this script on different IPs, make sure the IP of the server which will run this script is added to <strong>query_ip_whitelist.txt</strong> in your Teamspeak 3 installation directory.
        <ul>
          <li>I assume you need to restart TS3 for this to take effect.
          </li>
        </ul>
      </li>
      <li>Import the <strong>create-table.sql</strong> file into phpBB's database.
        <ul>
          <li>It creates one empty table called "EVE Registration".
          </li>
          <li>This can be done via the command line mysql command or with a tool like phpMyAdmin.
          </li>
        </ul>
      </li>
      <li>Create a cron job to run the check-users.php script often.
        <ul>
          <li>For example, <strong style="font-family: monospace">* * * * * php /home/username/public_html/eve-api-reg/check-users.php &gt; /dev/null 2&gt;&amp;1</strong> (with your actual path) would run the script every minute (advisable) and not email you any output.
          </li>
          <li>More info available on the <a href="http://en.wikipedia.org/wiki/Cron#Examples">cron Wikipedia article</a> or the cron manual
          </li>
          <li>Alternatively, you could allow access to it via the web (remove it from the <strong>.htaccess</strong>), give it a random URL that nobody else knows, and call it remotely from another server or computer (maybe via a Window Task Scheduler job which browses to the page or something similar).
          </li>
        </ul>
      </li>
      <li>Add a link, preferably in the main navigation of your forums to the registration page (eg. "/eve-api-reg/" if the package was extracted to the root of your web space and not renamed).
        <ul>
          <li>For example, the following would work if pasted into any phpBB style template file: <strong style="font-family: monospace">&lt;!-- IF S_USER_LOGGED_IN --&gt;&lt;a href=&quot;/eve-api-reg/&quot;&gt;EVE API Registration&lt;/a&gt;&lt;!-- ENDIF --&gt;</strong>
          </li>
        </ul>
      </li>
    </ol>
    <h2>
      Components
    </h2>
    <ul>
      <li>index.php
        <ul>
          <li>The registration page
          </li>
          <li>Does some dynamic AJAX/AJAJ stuff to walk the user through the registration process
          </li>
          <li>Verifies submitted data and puts it in the registratin database
          </li>
          <li>Calls the check-users.php script when a user successfully registers
          </li>
        </ul>
      </li>
      <li>admin/index.php
        <ul>
          <li>Lists all registrations and each user's registration data.
          </li>
          <li>Shows last 10 registration errors.
          </li>
          <li>Sortable
          </li>
        </ul>
      </li>
      <li>check-users.php
        <ul>
          <li>This script does most of the actual work.
          </li>
          <li>When run, it attempts to check the API of 1 user and update their forums and TS groups as necessary.
          </li>
          <li>It will only check a user if the current time is past their EVE API CachedUntil time if they're in TS.  Otherwise, it will check them if it's at least 23 hours past it.  The default cache time for EVE API character list data used to be 1 hour, but it seems they've lowered it, maybe temporarily for testing purposes due to the new key system, so if a check happens and the CachedUntil time is less than 1 hour away from the check, 1 hour from the check will be stored instead of the actual CachedUntil time.  These frequencies are configurable.
          </li>
          <li>Users are prioritized first by whether or not they're in TS (people in TS first), and then by how old their CachedUntil time is (older first).
          </li>
          <li>Of those users who've never been checked, those with the highest forums user IDs (newest registrations) are prioritized, in order to make it almost certain they'll be instantly given rights after they register.
          </li>
          <li>It never currently checks a specific user when run, but instead goes by the above priorities. This means that while it'll very likely instantly give a user rights in TS and to forums groups after they successfully register (assuming they're in TS), it's not guaranteed.
          </li>
        </ul>
      </li>
      <li>config.inc.php
        <ul>
          <li>Configuration, documented
          </li>
        </ul>
      </li>
      <li>create-table.sql
        <ul>
          <li>MySQL script to create the necessary "EVE Registration" table to store the registration data for each user
          </li>
        </ul>
      </li>
      <li>errors.txt
        <ul>
          <li>A log of registration errors and notices.
          </li>
          <li>You can clear it from time to time or use Linux's logrotate on it, but it needs to stay writable by the web server if you want logging to keep working.
          </li>
        </ul>
      </li>
      <li>.htaccess
        <ul>
          <li>Blocks access via the web to viewing errors.txt and to running the check-users.php script
          </li>
        </ul>
      </li>
      <li>setup.inc.php
        <ul>
          <li>Contains some shared functions that both the check-users.php and index.php scripts use
          </li>
        </ul>
      </li>
      <li>eve-api-get-names.json.php
        <ul>
          <li>Provides the data for the AJAX (actually AJAJ) dynamic Javascript functionality of the registration page
          </li>
        </ul>
      </li>
      <li>TeamSpeak3 folder
        <ul>
          <li><a href="http://addons.teamspeak.com/directory/tools/integration/TeamSpeak-3-PHP-Framework.html">TeamSpeak 3 PHP Framework</a> used by the system
          </li>
        </ul>
      </li>
      <li>update-table-153-154.sql
        <ul>
          <li>"EVE Registration" database table update for updating from 1.53 or below to 1.54 or higher, and only required if Teamspeak functionality is disabled
          </li>
        </ul>
      </li>
    </ul>
  </body>
</html>